use core::ops::Deref;

use stm32f1::stm32f103::{
    gpioa, gpiob, gpioc, gpiod, gpioe, gpiof, gpiog, GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF,
    GPIOG,
};


pub struct PA;
pub struct PB;
pub struct PC;
pub struct PD;
pub struct PE;
pub struct PF;
pub struct PG;

impl Deref for PA {
    type Target = gpioa::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*GPIOA::PTR }
    }
}

impl Deref for PB {
    type Target = gpiob::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*GPIOB::PTR }
    }
}

impl Deref for PC {
    type Target = gpioc::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*GPIOC::PTR }
    }
}

impl Deref for PD {
    type Target = gpiod::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*GPIOD::PTR }
    }
}

impl Deref for PE {
    type Target = gpioe::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*GPIOE::PTR }
    }
}

impl Deref for PF {
    type Target = gpiof::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*GPIOF::PTR }
    }
}

impl Deref for PG {
    type Target = gpiog::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*GPIOG::PTR }
    }
}
